package net.stogi.dsper.ui.client.module.datasource;

import net.stogi.dsper.api.dto.DataSourceDto;

import com.google.gwt.event.shared.GwtEvent;

public class OpenDataSourceEditorEvent extends GwtEvent<OpenDataSourceEditorHandler> {

	public static final GwtEvent.Type<OpenDataSourceEditorHandler> TYPE = new GwtEvent.Type<OpenDataSourceEditorHandler>();

	private DataSourceDto dataSource;

	public OpenDataSourceEditorEvent(DataSourceDto dataSource) {
		this.dataSource = dataSource;
	}

	protected OpenDataSourceEditorEvent() {}

	@Override
	public Type<OpenDataSourceEditorHandler> getAssociatedType() {
		return TYPE;
	}

	/**
	 * @return the dataSource
	 */
	public DataSourceDto getDataSource() {
		return dataSource;
	}

	/**
	 * @param dataSource
	 *            the dataSource to set
	 */
	public void setDataSource(DataSourceDto dataSource) {
		this.dataSource = dataSource;
	}

	@Override
	protected void dispatch(OpenDataSourceEditorHandler handler) {
		handler.onOpenDataSourceEditor(this);
	}
}
